package com.sias.swagger.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author 吴文杰
 * @version 1.0
 * @createTime 2023-05-19 02:58:52
 */
@Configuration
@EnableSwagger2
public class Knife4jConfig {

  // @Bean
  // public Docket defaultApi2() {
  //   return new Docket(DocumentationType.SWAGGER_2)
  //           .apiInfo(new ApiInfoBuilder()
  //                   .title("接口文档")
  //                   .description("springboot-init")
  //                   .version("1.0")
  //                   .build())
  //           .groupName("tom")
  //           .select()
  //           // 指定 Controller 扫描包路径
  //           .apis(RequestHandlerSelectors.basePackage("com.sias.swagger.controller"))
  //           .paths(PathSelectors.any())
  //           .build();
  // }

  @Bean
  public Docket sograApi(){
    return new Docket(DocumentationType.SWAGGER_2)
            .groupName("sogra")
            .apiInfo(new ApiInfoBuilder()
                    .title("sogra")
                    .description("sogra的接口文档")
                    .version("v1.0")
                    .build())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.sias.swagger.controller"))
            .paths(PathSelectors.any())
            .build();

  }
}
